# -.- coding:utf-8 -.-# __author__= 'vivi'from operator import *#返回一个函数时，该函数实际并未执行，def lazy_sum(*args):    def sum():        ax = 0        for n in args:            ax = ax + n        return ax    return sumf = lazy_sum(1, 2, 3, 4, 5)print(f)print(f())'''执行结果：<function lazy_sum.<locals>.sum at 0x00A66E40>15'''# why f1(), f2(), f3() return 9, 9, 9 rather than 1, 4, 9?def count():    fs = []    for i in range(1, 4):        def f():           return i * i        fs.append(f)    return fsf1, f2, f3 = count()print(f1())print(f2())print(f3())#fix,return 1, 4, 9def count():    fs = []    def f(n):        def j():            return n *n        return j    for i in range(1, 4):        fs.append(f(i))    return fsf1, f2, f3 = count()print(f1())print(f2())print(f3())